"""
FIVEDASH(TM) -- General Purpose Accounting Software
Copyright (C) 2008  Obol Software Pty Ltd

This program is free software: you can redistribute it and/or modify
it. For terms and conditions, see fivedash/license/license.txt

"""

common_list = '''
                            <div class="title title2 hr-title ">                            
                                <dl class="hr-tit">
                                        {% for list_colname in list_colnames %}
                                                <dd class="{% if list_colname.find(' ')>0 %}{{str(list_colname.split(' ',1)[1]).lower()}}{% else %}{{list_colname.lower()}}{% endif %}">{{list_colname}}</dd>
                                        {% endfor %}
                                        <dt>Actions</dt>
                                </dl> 
                                {% for element in results %}
                                    {% if (results.index(element))%2!=0 %}
                                        <dl class="list-bg2">
                                    {% else %}
                                        <dl>
                                    {% endif %}
                                        {% for db_colname in db_colnames %}
                                                <dd class="{% if db_colname.find('_')>0 %}{{str(db_colname.split('_',1)[1]).lower()}}{% else %}{{db_colname.lower()}}{% endif %}">{{element[db_colname]}}</dd>
                                        {% endfor %}                                        
                                        <dt>
                                                {% if element['edit_url'] %}
                                                <a href="{{element['edit_url']}}"><img src="/{{skin}}/{{element['edit']}}.gif" /></a>
                                                <a href="{{element['del_url']}}"><img src="/{{skin}}/{{element['del']}}.gif" /></a>
                                                {% else %}
                                                &nbsp;
                                                {% endif %}
                                        </dt>
                                    </dl>
                                {% endfor %}
                            </div>
                            <div class="img-line">&nbsp;</div>
                            <div class="bottom input">
                                    <input name="add" type="button" value="Add entity" onClick="javascript:location.href='{{add_url}}';" />
                            </div>  
'''

common_search = '''<div class="list-bg">&nbsp;</div>
                                <form id="search"  action="/bin/hr.py/search_employee_salary_details" enctype="multipart/form-data" method="post">
            <fieldset class="form">
                <label>Enter employee's code : </label>
                <input type="text" name="employee_code"/>
                <input type="button" name="search"  onClick="check_submit('search')" value="search" class="button2"/>
                </fieldset>
                </form>
                <div class="list-bg">&nbsp;</div>
                <script type="text/javascript"> 
                function check_submit(id)
                {
                    var form=document.getElementById(id);
                    form.submit();
                }
                </script>
'''

common_edit = '''
                {% if len(employee)>0 %}
                        <form id="edit" action="/bin/hr.py/edit_employee_salary?employee_id={{employee['employee_id']}}" enctype="multipart/form-data" method="post">
                        <div class="title title2">Edit salary</div>
                        <fieldset class="form">
                                <div class="new-oth">{{employee['given_name']}} {{employee['surname']}}</div><br/><br/>
                                <label>employee code:</label>{{employee['employee_code']}}<br/><br/>
                                <label>nation:</label>{{employee['nation']}}<br/><br/>
                        {% for section in employee_sections %}
                                <label>{{section['name']}}:</label>
                                <input type="text" name="amount{{section['section_id']}}" value="{{section['amount']}}"/><br/><br/>
                        {% endfor %}
                        <label>reason:</label>
                        <input type="text" name="reason" maxlength="80"/><br/><br/>
                        <div class=" bottom input"><input type="submit" name="submit" value="edit"/></div>
                        </fieldset>
                        </form>
                {% endif %}
'''


